package com.itjeffrey.autocode.security;

import java.util.Collection;

import com.itjeffrey.autocode.bo.LoginInfoBO;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

/**
 * 安全用户模型
 * @From: Jeffrey
 * @Date: 2020/12/01
 */
public class JwtUserDetails extends LoginInfoBO implements UserDetails {

    public JwtUserDetails(){
    }

    public JwtUserDetails(String loginName, String loginPwd, Collection<? extends GrantedAuthority> authorities){
        super(loginName, loginPwd, authorities);
    }

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return super.getAuthorities();
    }

    @Override
    public String getPassword() {
        return super.getLoginPwd();
    }

    @Override
    public String getUsername() {
        return super.getLoginName();
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }
}